package kr.cafedev.hangul;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;

public class SplashActivity extends Activity {
	long mSplashTime=1000;
	boolean mPaused = false;
	boolean mSplashActive = true;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.splash);
        
        Thread splashTimer = new Thread(){
        	public void run(){
        		try{
        			long ms = 0;
        			while(mSplashActive && ms <= mSplashTime){
        				sleep(100);
        				if(!mPaused){
        					ms += 100;
        				}
        			}
        			//startActivity(new Intent("com.google.app.splashy.CLEARSPLASH"));
        			startActivity(new Intent(SplashActivity.this, MainActivity.class));
        			
        		}catch(Exception e){
        			
        		}finally{
        			finish();
        		}
        	}
        };
        
        splashTimer.start();
    }

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		super.onKeyDown(keyCode, event);
		mSplashActive = false;
		return true;
		
	}

	@Override
	protected void onPause() {
		super.onPause();
		mPaused = true;
	}

	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		mPaused = false;
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
	}
}